package com.xh.bussiness.course.bean.request;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class StatisticsCompareDto {
    @ApiModelProperty("当前数")
    private int current;
    @ApiModelProperty("之前数")
    private int previous;
    @ApiModelProperty("当前数减去之前数的绝对值")
    private int compare;
    @ApiModelProperty("之前数和现在数比较")
    private String range;

    public int getCompare() {
        return Math.abs(current - previous);
    }

    public String getRange() {
        if(current - previous > 0) {
            return "UP";
        } else if (current - previous < 0) {
            return "DOWN";
        }
        return "LINE";
    }
}
